import 'package:accumulation/function/flutter_webview_plugin.dart';
import 'package:accumulation/function/web_view_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class WebViewPage extends StatefulWidget{

  WebViewPage({this.url, Key key}) : super(key: key);

  final String url;

  @override
  State<StatefulWidget> createState() => _WebViewState();

}

class _WebViewState extends State<WebViewPage> {

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text('WebView'),
      ),
      body: Column(
        children: <Widget>[
          Padding(
            padding: EdgeInsets.symmetric(vertical: 10.0),
            child: Text("官方插件：webview_flutter"),
          ),
          Padding(
            padding: EdgeInsets.symmetric(vertical: 10.0),
            child: Text("无法获取webview加载进度，从而控制进度条的演变"),
          ),
          Padding(
            padding: EdgeInsets.symmetric(vertical: 10.0),
            child: CupertinoButton(
              color: Colors.blue,
              child: Text('演示'),
              onPressed: (){
                Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) {
                  return WebViewFlutterPage();
                }));
              },
            ),
          ),
          Divider(
            color: Colors.grey,
          ),
          Padding(
            padding: EdgeInsets.symmetric(vertical: 10.0),
            child: Text("常用插件：flutter_webview_plugin"),
          ),
          Padding(
            padding: EdgeInsets.symmetric(vertical: 10.0),
            child: Text("可以获取webview加载进度，从而控制进度条的演变"),
          ),
          Padding(
            padding: EdgeInsets.all(10.0),
            child: Text("但是问题是，如果AndroidManifest的启动activity为.MainActivity时，"
                "插件运行正常；如果将启动activity修改为io.flutter.embedding.android.FlutterActivity("
                "为了解决使用image_picker的情况下首次安装使用相册选择图片时需要选择两边的bug)，就会报找不到插件的错误"),
          ),
          Padding(
            padding: EdgeInsets.symmetric(vertical: 10.0),
            child: CupertinoButton(
              color: Colors.blue,
              child: Text('演示'),
              onPressed: (){
                Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) {
                  return FlutterWebViewPluginPage();
                }));
              },
            ),
          ),
        ],
      ),
    );
  }



}